package com.frank.demo.service;/*
 *@author:xec
 *@date:2022/5/17  17:20
 */

import com.frank.demo.websocket.WebSocketServer;
import org.slf4j.MDC;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class WsService {
    @Resource
    public WebSocketServer webSocketServer;

    @Async
    public void sendInfo(String message,String logId){
        MDC.put("LOG_ID",logId);
        // 使用ws服务端的发送消息方法发送消息
        webSocketServer.sendInfo(message);
    }
}
